#pragma once
#include <pthread.h>
#include <arpa/inet.h>
#include "ThreadPool.h"


struct MyInfo;
void computeConn(void* arg);
void acceptComputeConn(void* arg);
void acceptConn(void* arg);
void working(void* arg);

struct SockInfo
{
	int fd;
	pthread_t tid;
	struct sockaddr_in addr;
};



struct PoolInfo
{
	PoolInfo() {
		fd = -1;
		p = nullptr;
	}

	PoolInfo(int f, int computeF, ThreadPool<MyInfo>* pinfo) {
		computeFd = computeF;
		fd = f;
		p = pinfo;
	}
	int computeFd;
	int fd;
	ThreadPool<MyInfo>* p;
};



struct MyInfo
{
	MyInfo() {
		poolInfo = new PoolInfo();
		socketInfo = new SockInfo();
	}

	MyInfo(PoolInfo* p) {
		poolInfo = p;
		socketInfo = new SockInfo();
	}

	MyInfo(SockInfo* s) {
		socketInfo = s;
		poolInfo = new PoolInfo();
	}

	PoolInfo* poolInfo;	       //�̳߳�ָ��
	SockInfo* socketInfo;
};
